home *** CD-ROM | disk | FTP | other *** search
- // Dynamic link library implementation of NeuroSolutions BiasAxon component using the performAxon protocol
-
- #include "NSDLL.h"
-
- /***********************************/
- /* Forward activation of component */
-
- __declspec(dllexport) void performAxon(
- DLLData *instance, // Pointer to instance data
- NSFloat *data, // Pointer to the layer of processing elements (PEs)
- int rows, // Number of rows of PEs in the layer
- int cols // Number of columns of PEs in the layer
- )
- {
- int i,length=rows*cols;
- NSFloat *bias = getWeights(instance);
- NSFloat beta = getFloatParameter(instance, 2, 1);
-
- for (i=0; i<length; i++)
- data[i] = beta*data[i] + bias[i];
- }
-
- /******************************************/
- /* Management of instance data (OPTIONAL) */
-
- __declspec(dllexport) DLLData *allocAxon(
- DLLData *oldInstance, // Pointer to the last instance if reallocating
- int rows, // Number of rows of PEs in the layer
- int cols // Number of columns of PEs in the layer
- )
- {
- DLLData *instance = allocDLLInstance(oldInstance);
- setParameterName(instance, 2, 1, "Beta", FALSE);
- setFloatParameter(instance, 2, 1, 1.0f, FALSE);
- setWeights(instance, rows*cols);
- return instance;
- }
-
- __declspec(dllexport) void freeAxon(DLLData *instance)
- {
- freeDLLInstance(instance);
- }
-
-